package com.banmao;

import lombok.extern.slf4j.Slf4j;

import java.util.List;
import java.util.Map;
import java.util.Scanner;

@Slf4j
public class Main {


    public static void main(String[] args) throws Exception {

        String comicCode = "29xm";
        List<Map<String, String>> menus = XManhua.getMenu(comicCode);

        // 按下标展示每一话
        int index = 1;
        for (Map<String, String> menu : menus) {
            System.out.printf("%d -- %s\n", index++, menu.values().stream().findFirst().get());
        }

        Scanner scanner = XManhua.getScanner();
        System.out.println("输入起始编号:");
        int leftIndex = scanner.nextInt();
        System.out.println("输入结尾编号:");
        int rightIndex = scanner.nextInt();

        log.info("正在处理，请稍后...");
        XManhua.downloadImages(menus, leftIndex, rightIndex);
        log.info("下载完成");

    }

}
